function generateHtmlcurrentTable(ds){

    var html;
	
	html= '<table  style="margin-bottom:0px; text-align: center">';
	html+='	<thead>';
	html+='		<th style="width:50%; text-align: center; font-size: 10pt">時間間隔</th>';
	html+='		<th style="width:50%; text-align: center; font-size: 10pt">電力量(Wh)</th>';
	html+='	</thead>';
	html+='	<tbody>';
	
	for (var i = (ds.getCount()-1); i >=0; i--)
	{
		
	html+='		<tr>';
	html+='			<td style="width:50%; text-align: center; font-size: 10pt">'+ ds.getAt(i).data.name +'</td>';
	html+='			<td style="width:50%; text-align: center; font-size: 10pt">'+ ds.getAt(i).data.data1 +'</td>';
	html+='		</tr>';
		
	}
	
	html+='	</tbody>';
	html+='</table>';
	
    return html;
}



function generateHtmlMonthsTable(ds){
    var html;
	
	html= '<table  style="margin-bottom:0px; text-align: center">';
	html+='	<thead>';
	html+='		<th style="width:34%; text-align: center; font-size: 10pt">月</th>';
	html+='		<th style="width:33%; text-align: center; font-size: 10pt">対象(kWh)</th>';
	html+='		<th style="width:33%; text-align: center; font-size: 10pt">比較(kWh)</th>';
	html+='	</thead>';
	html+='	<tbody>';
	
	for (var i = 0; i < ds.getCount(); i++)
	{
		
	html+='		<tr>';
	html+='			<td style="width:34%; text-align: center; font-size: 10pt">'+ ds.getAt(i).data.name +'</td>';
	html+='			<td style="width:33%; text-align: center; font-size: 10pt">'+ parseFloat(ds.getAt(i).data.data1).toFixed(1) +'</td>';
	html+='			<td style="width:33%; text-align: center; font-size: 10pt">'+ ds.getAt(i).data.data2 +'</td>';
	html+='		</tr>';
		
	}
	
	html+='	</tbody>';
	html+='</table>';
	
    return html;
}

function generateHtmlDaysTable(ds,viewFrom,viewTo){

	var html;
	if(viewTo == -1){
		viewTo = ds.getCount();
	}
	
		
		html= '<table style="margin-bottom:0px">';
		html+='	<thead>';
		html+='		<th style="text-align: center; font-size: 10pt;">日</th>';
		html+='		<th style="text-align: center; font-size: 10pt;">対象(Wh)</th>';
		html+='		<th style="text-align: center; font-size: 10pt;">比較(Wh)</th>';
		html+='	</thead>';
		html+='	<tbody>';
		
		for (var i = viewFrom; i < viewTo; i++)
		{
			
		html+='		<tr>';
		html+='			<td style="text-align: center; font-size: 10pt;" >'+ ds.getAt(i).data.name +'</td>';
		html+='			<td style="text-align: center; font-size: 10pt;">'+ ds.getAt(i).data.data1 +'</td>';
		html+='			<td style="text-align: center; font-size: 10pt;">'+ ds.getAt(i).data.data2 +'</td>';
		html+='		</tr>';
			
		}
		
		html+='	</tbody>';
		html+='</table>';
		
	    return html;
}

function generateHtmlHoursTable(ds,viewFrom,viewTo){

	var html;
	if(viewTo == -1){
		viewTo = ds.getCount();
	}
		
	html= '<table style="margin-bottom:0px">';
	html+='	<thead>';
	html+='		<th style="text-align: center; font-size: 10pt;">時</th>';
	html+='		<th style="text-align: center; font-size: 10pt;">対象(Wh)</th>';
	html+='		<th style="text-align: center; font-size: 10pt;">比較(Wh)</th>';
	html+='	</thead>';
	html+='	<tbody>';
	
	for (var i = viewFrom; i < viewTo; i++) {
		html+='		<tr>';
		html+='			<td style="text-align: center; font-size: 10pt;" >'+ ds.getAt(i).data.name +'</td>';
		html+='			<td style="text-align: center; font-size: 10pt;">'+ ds.getAt(i).data.data1 +'</td>';
		html+='			<td style="text-align: center; font-size: 10pt;">'+ ds.getAt(i).data.data2 +'</td>';
		html+='		</tr>';
	}
	
	html+='	</tbody>';
	html+='</table>';
	
    return html;
}


function generateHtmlStatisticTable(ds){
    var html;
	
	html = '<table  style="margin-bottom:0px; text-align: center">';
	html += '  <thead>';
	html += '	   <tr>';
	html += '		 <th rowspan="2" style="width:20%; text-align: center; font-size: 10pt">月</th>';
	html += '		 <th colspan="2" style="width:20%; text-align: center; font-size: 10pt">1年前</th>';
	html += '		 <th colspan="2" style="width:20%; text-align: center; font-size: 10pt">2年前</th>';
	html += '	   </tr>';
	html += '	   <tr>';
	html += '		 <th style="width:20%; text-align: center; font-size: 10pt">電力量(kWh)</th>';
	html += '		 <th style="width:20%; text-align: center; font-size: 10pt">最大電力(kWh)</th>';
	html += '		 <th style="width:20%; text-align: center; font-size: 10pt">電力量(kWh)</th>';
	html += '		 <th style="width:20%; text-align: center; font-size: 10pt">最大電力(kWh)</th>';
	html += '	   </tr>';
	html += '  </thead>';

	html += '  <tbody>';
	for (var i = 0; i < ds.getCount(); i++) {
		html += '		<tr>';
		html += '			<td style="width:20%; text-align: center; font-size: 10pt">'+ ds.getAt(i).data.name +'</td>';
		html += '			<td style="width:20%; text-align: center; font-size: 10pt">'+ ds.getAt(i).data.d1T +'</td>';
		html += '			<td style="width:20%; text-align: center; font-size: 10pt">'+ ds.getAt(i).data.d1M +'</td>';
		html += '			<td style="width:20%; text-align: center; font-size: 10pt">'+ ds.getAt(i).data.d2T +'</td>';
		html += '			<td style="width:20%; text-align: center; font-size: 10pt">'+ ds.getAt(i).data.d2M +'</td>';
		html += '		</tr>';
	}
	html +='	</tbody>';
	html +='</table>';
	
    return html;
}

function generateHtmlSettingTable(){

    var html;
	
	html= '<table style="margin-bottom:0px; text-align: center">';
	html+='	<thead>';
	html+='		<th style="width:15%; text-align: center; font-size: 10pt">優先順</th>';
	html+='		<th style="width:50%; text-align: center; font-size: 10pt">マクロ名</th>';
	html+='		<th style="width:10%; text-align: center; font-size: 10pt"></th>';
	html+='		<th style="width:10%; text-align: center; font-size: 10pt"></th>';
	html+='		<th style="width:15%; text-align: center; font-size: 10pt"></th>';
	html+='	</thead>';
	html+='	<tbody>';

	html+='		<tr>';
	html+='			<td style="width:15%; text-align: center; font-size: 10pt">1</td>';
	html+='			<td style="width:50%; text-align: center; font-size: 10pt">和室</td>';
	html+='			<td style="width:10%; text-align: center; font-size: 10pt"><button>↓</button></td>';
	html+='			<td style="width:10%; text-align: center; font-size: 10pt"><button>↑</button></td>';
	html+='			<td style="width:15%; text-align: center; font-size: 10pt">無効</td>';
	html+='		</tr>';
	
	html+='		<tr>';
	html+='			<td style="width:15%; text-align: center; font-size: 10pt">2</td>';
	html+='			<td style="width:50%; text-align: center; font-size: 10pt">エアコン１</td>';
	html+='			<td style="width:10%; text-align: center; font-size: 10pt"><button>↓</button></td>';
	html+='			<td style="width:10%; text-align: center; font-size: 10pt"><button>↑</button></td>';
	html+='			<td style="width:15%; text-align: center; font-size: 10pt">無効</td>';
	html+='		</tr>';
	
	html+='		<tr>';
	html+='			<td style="width:15%; text-align: center; font-size: 10pt">3</td>';
	html+='			<td style="width:50%; text-align: center; font-size: 10pt">子供部屋</td>';
	html+='			<td style="width:10%; text-align: center; font-size: 10pt"><button>↓</button></td>';
	html+='			<td style="width:10%; text-align: center; font-size: 10pt"><button>↑</button></td>';
	html+='			<td style="width:15%; text-align: center; font-size: 10pt">無効</td>';
	html+='		</tr>';
	
	for (var i = 4; i<11; i++)
	{
		
	html+='		<tr>';
	html+='			<td style="width:15%; text-align: center; font-size: 10pt">'+i+'</td>';
	html+='			<td style="width:50%; text-align: center; font-size: 10pt"></td>';
	html+='			<td style="width:10%; text-align: center; font-size: 10pt"><button>↓</button></td>';
	html+='			<td style="width:10%; text-align: center; font-size: 10pt"><button>↑</button></td>';
	html+='			<td style="width:15%; text-align: center; font-size: 10pt">無効</td>';
	html+='		</tr>';
	}
	
	html+='	</tbody>';
	html+='</table>';
	
    return html;
}

function generateHtmlMainSettingTable(){

    var html;
	
	html= '<table style="margin-bottom:0px; text-align: center">';
	html+='	<thead>';
	html+='		<th style="width:30%; text-align: center; font-size: 10pt">日時</th>';
	html+='		<th style="width:25%; text-align: center; font-size: 10pt">検出条件</th>';
	html+='		<th style="width:45%; text-align: center; font-size: 10pt">制御内容</th>';
	html+='	</thead>';
	html+='	<tbody>';

	html+='		<tr>';
	html+='			<td style="width:30%; text-align: center; font-size: 10pt">2013/9/26 14:31</td>';
	html+='			<td style="width:25%; text-align: center; font-size: 10pt">48.76A</td>';
	html+='			<td style="width:45%; text-align: center; font-size: 10pt"></td>';
	html+='		</tr>';
	
	html+='		<tr>';
	html+='			<td style="width:30%; text-align: center; font-size: 10pt">2013/9/14 12:27</td>';
	html+='			<td style="width:25%; text-align: center; font-size: 10pt">48.21A</td>';
	html+='			<td style="width:45%; text-align: center; font-size: 10pt"></td>';
	html+='		</tr>';
	
	html+='		<tr>';
	html+='			<td style="width:30%; text-align: center; font-size: 10pt">2013/9/1 12:54</td>';
	html+='			<td style="width:25%; text-align: center; font-size: 10pt">726W</td>';
	html+='			<td style="width:45%; text-align: center; font-size: 10pt"></td>';
	html+='		</tr>';
	
	html+='		<tr>';
	html+='			<td style="width:30%; text-align: center; font-size: 10pt">2013/9/1 12:53</td>';
	html+='			<td style="width:25%; text-align: center; font-size: 10pt">48.54A</td>';
	html+='			<td style="width:45%; text-align: center; font-size: 10pt"></td>';
	html+='		</tr>';
	
	for (var i = 4; i<11; i++)
	{
		
	html+='		<tr>';
	html+='			<td style="width:30%; text-align: center; font-size: 10pt"></td>';
	html+='			<td style="width:25%; text-align: center; font-size: 10pt"></td>';
	html+='			<td style="width:45%; text-align: center; font-size: 10pt"></td>';
	html+='		</tr>';
	}
	
	html+='	</tbody>';
	html+='</table>';
	
    return html;
}

